﻿@model ShipmentDetailsModel
@using Nop.Web.Models.Order;
@{
    Layout = "~/Views/Shared/_Root.cshtml";
    //title
    Html.AddTitleParts(T("PageTitle.ShipmentDetails").Text);
}
<div class="page shipment-details-page">
    <div class="page-title">
        <h1>@string.Format(T("Order.Shipments.Information").Text, Model.Id)</h1>
    </div>
    <div class="page-body">
        <div class="overview">
            <div class="order-id">
                <strong>@T("Order.Shipments.Order#")@Model.Order.Id</strong>
            </div>
            <div class="shipping-method">
                @T("Order.Shipments.ShippingMethod"): @Model.Order.ShippingMethod
            </div>
            <div class="shipped-date">
                @T("Order.Shipments.ShippedDate"):
                @if (Model.ShippedDate.HasValue)
                {
                    @Model.ShippedDate.Value.ToString("D")
                }
                else
                {
                    @T("Order.Shipments.ShippedDate.NotYet")
                }
            </div>
            <div class="delivery-date">
                @T("Order.Shipments.DeliveryDate"):
                @if (Model.DeliveryDate.HasValue)
                {
                    @Model.DeliveryDate.Value.ToString("D")
                }
                else
                {
                    @T("Order.Shipments.DeliveryDate.NotYet")
                }
            </div>
            <div class="shipping-method">
                @T("Order.Shipments.ShippingMethod"): @Model.Order.ShippingMethod
            </div>
            @if (!String.IsNullOrEmpty(Model.TrackingNumber))
            {
                <div class="tracking-number">
                    @T("Order.Shipments.TrackingNumber"):
                    @if (!string.IsNullOrEmpty(Model.TrackingNumberUrl))
                    {
                        <a href="@Model.TrackingNumberUrl" class="tracking-url">@Model.TrackingNumber</a>
                    }
                    else
                    {
                        @Model.TrackingNumber
                    }
                </div>
            }
            <div class="shipping-address">
                <div class="section-title">
                    @T("Order.Shipments.ShippingAddress")
                </div>
                <div class="name">
                    @Model.Order.ShippingAddress.FirstName @Model.Order.ShippingAddress.LastName
                </div>
                <div class="email">
                    @T("Order.Shipments.Email"): @Model.Order.ShippingAddress.Email</div>
                <div class="phone">
                    @T("Order.Shipments.Phone"): @Model.Order.ShippingAddress.PhoneNumber</div>
                <div class="fax">
                    @T("Order.Shipments.Fax"): @Model.Order.ShippingAddress.FaxNumber</div>
                @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.Company))
                {
                    <div class="company">
                        @Model.Order.ShippingAddress.Company
                    </div>
                }
                <div class="address1">
                    @Model.Order.ShippingAddress.Address1</div>
                @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.Address2))
                {
                    <div class="address2">
                        @Model.Order.ShippingAddress.Address2
                    </div>
                }
                <div class="city-state-zip">
                    @Model.Order.ShippingAddress.City, @Model.Order.ShippingAddress.StateProvinceName
                    @Model.Order.ShippingAddress.ZipPostalCode</div>
                @if (!String.IsNullOrEmpty(Model.Order.ShippingAddress.CountryName))
                {
                    <div class="country">
                        @Model.Order.ShippingAddress.CountryName
                    </div>
                }
            </div>
        </div>
        @if (Model.Items.Count > 0)
        {
            <div class="products">
                <div class="section-title">
                    @T("Order.Shipments.Product(s)")
                </div>
                <ul data-role="listview" data-inset="true" data-filter="false" data-theme="c">
                    @foreach (var item in Model.Items)
                    {
                        <li>
                            <div class="products-box">
                                <div class="product">
                                    <strong><a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details">@item.ProductName</a></strong>
                                    @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                    {
                                        <div class="attributes">
                                            @Html.Raw(item.AttributeInfo)
                                        </div>
                                    }
                                </div>
                                @if (Model.ShowSku && !string.IsNullOrEmpty(item.Sku))
                                {
                                    <div class="sku">
                                        @T("Order.Shipments.Product(s).SKU"): @item.Sku
                                    </div>
                                }
                                <div class="qty">
                                    @T("Order.Shipments.Product(s).Quantity"): @item.QuantityShipped
                                </div>
                            </div>
                        </li>
                    }
                </ul>
            </div>
        }
        @if (Model.ShipmentStatusEvents.Count > 0)
        {
            <div class="shipment-status-events">
                <div class="section-title">
                    @T("Order.ShipmentStatusEvents")
                </div>
                <ul data-role="listview" data-inset="true" data-filter="false" data-theme="c">
                    @foreach (var item in Model.ShipmentStatusEvents)
                    {      
                        <li>
                            <div class="shipment-status-events-box">
                                <div>@T("Order.ShipmentStatusEvents.Event"): @item.EventName</div>
                                <div>@T("Order.ShipmentStatusEvents.Location"): @item.Location</div>
                                <div>@T("Order.ShipmentStatusEvents.Country"): @item.Country</div>
                                @if (item.Date.HasValue)
                                {
                                    <div>@T("Order.ShipmentStatusEvents.Date"): @item.Date.Value.ToString("D")</div>
                                }
                            </div>
                        </li>
                    }
                </ul>
            </div>
        }
    </div>
</div>
